<!DOCTYPE html>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<title>订单管理-鹿程智慧油站商户平台</title>
		<meta name="description" content="鹿程科技是提供加油站互联网化零管系统、营销及支付和大数据分析运营服务的行业领先科技公司。鹿程科技充分了解加油站行业的需求和新兴互联网的发展,依靠业内最先进的科技和标准化的运营,持续帮助油站业务发展创造价值。"/>
		<meta name="keywords" content="智慧油站,鹿程,鹿程智慧油站,鹿程智慧油站微信支付,加油站微信支付,加油站营销管理"/>
		<link rel="icon" href="https://static.zhihuiyouzhan.com.cn/static/styles/admin/img/title.ico" type="image/x-icon">
		<link rel="shortcut icon" href="https://static.zhihuiyouzhan.com.cn/static/styles/admin/img/title.ico" type="image/x-icon">
		<link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
		<link rel="stylesheet" href="../layui/css/layui.css" />
		<link rel="stylesheet" href="../css/style.css" />
	</head>
<body>
	
	<section class="section-right">
	<div class="deer-tit marke-tit">
		<h3>邀请好友</h3>
		<h4>效益分析</h4>
	</div>
	<article class="ware-contents">
		<!--form-->
		<form class="layui-form">
			<!--ware-content-input-->
			<section class="ware-c-input marke-c-input">
				<dl>
				    <dt><i class="must">*</i>标题：</dt>
				    <dd><input type="text" name="title" lay-verify="required" lay-verType="tips" placeholder="请输入活动名称" class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>海报上传：</dt>
			  		<dd class="marke-input-img"><input lay-verify="required" lay-verType="tips"   type="text" style="width: 350px;" placeholder="图片尺寸 750*400" class="marke-img layui-input layui-disabled" disabled order="1" value=""/><span class="car">上传</span><span class="imgview">预览</span><span class="imgdel">删除</span></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>活动类型：</dt>
				    <dd>
				    	<select name="cate_id">
					        <option value="1">砍总价</option>
					        <option value="2">砍单价</option>
				      	</select>
				    </dd>
			  	</dl>
			  		<dl>
				    <dt><i class="must">*</i>选择优惠券：</dt>
				    <dd>
				    	<select name="type">
					        <option value="0">砍价券</option>
					        <option value="1">夏日香气</option>
					        <option value="2">满200减100</option>
					        <option value="3">新用户专享</option>
					        <option value="4">一起迎春</option>
					        <option value="5">倒计时</option>
					        <option value="6">优惠券10</option>
				      	</select>
				    </dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>会员等级：</dt>
				    <dd style="line-height: 36px;" id="checked" lay-verify="checkeds">
				    	<input type="checkbox" title="全选"  name='number'checked lay-filter="checked" />
				    	<input type="checkbox" title="普通会员" name='number1' checked />
				    	<input type="checkbox" title="中级会员" name='number2' checked />
				    	<input type="checkbox" title="至尊会员" name='number3' checked />
				    	<input type="checkbox" title="初级会员" name='number4' checked />
				    	<input type="checkbox" title="高级会员" name='number5' checked />
				    	<input type="checkbox" title="银卡会员" name='number6' checked />
				    </dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>单次砍最高价格：</dt>
				    <dd><input type="number" name="max" min="0" lay-verify="required|num" placeholder="请输入单次砍最高价格" lay-verType="tips" class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>单次砍最低价格：</dt>
				    <dd><input type="number" name="min" min="0" lay-verify="required|num" placeholder="请输入单次砍最低价格" lay-verType="tips" class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>产品原始价格：</dt>
				    <dd><input type="number" name="start_price" min="0" lay-verify="required|num"  placeholder="产品原始价格" lay-verType="tips" class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>产品最低价格：</dt>
				    <dd><input type="number" name="low_price" min="0" lay-verify="required|num"  placeholder="产品最低价格：" lay-verType="tips" class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>活动时间:</dt>
				    <dd><input type="text" name="sales" lay-verify="required" id="datetime"  placeholder="请选择活动时间" lay-verType="alert"  class="layui-input"></dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>活动状态：</dt>
			      	<dd>
				    	<select>
					        <option value="0">正常</option>
					        <option value="1">关闭</option>
				      	</select>
				    </dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>是否支持期间兑换：</dt>
				    <dd>
				    	<select>
					        <option value="0">是</option>
					        <option value="1">否</option>
				      	</select>
				    </dd>
			  	</dl>
			  	<dl>
				    <dt><i class="must">*</i>描述规则：</dt>
				    <dd>
<textarea id="content" name="describe" class="layui-textarea">
1.参与对象：所有符合会员等级的客户。
2.活动期间邀请好友或上传朋友圈参与活动，并在活动期间内完成砍价的小伙伴，即可获得优惠券奖励！！！
3.此次活动最终解释权归本油站所有。
</textarea>
				    </dd>
			  	</dl>
			</section>
			<!--/ware-content-input-->
			<!--submit-->
			<div class="ware-submit">
				<button class="submit" lay-submit lay-filter="Submit" lay-verify="editcontent">提交</button>
			</div>
			
			<!--/submit-->
		</form>
		<!--/form-->
	</article>
	</section>
	<!--js-->
	<aside>
		<script type="text/javascript" src="../layui/layui.js" ></script>
		<script type="text/javascript">
			layui.use(['form','jquery','upload','laydate','layer'],function(){
				var form=layui.form;
				var $=layui.jquery;
				var upload=layui.upload;
				var layer=layui.layer;
				var laydate=layui.laydate;
  
				laydate.render({
			   		 elem: '#datetime' //指定元素
			   		 ,type:'datetime'
			   		 ,range:'/'
			  	});
			  	
				
				
				//表单验证
				form.verify({
			  	num: [                 //判断是否为数字
				    /^((?:[0-9]\d*))(?:\.\d{1,2})?$/
				    ,'请输入一个合理的价格'   
				]
				,checkeds:function(){
					var num=0
					$('#checked>input').each(function(index,value){
						if($(value).prop('checked')==true){
							num++
						}
					})
					if(!num){
						return "您尚未选择任何会员等级"
					}
					
				}
		 		})
		 	 	//表单提交
				form.on('submit(Submit)', function(data){
					console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
					
					$.ajax({
			            url: '/',
			            data: data.field,
			            type: 'post',
			            datatype: 'json',
			            success: function (res) {
				                if (res.code == 1) {
				                	layer.msg(res.msg);
				                    return;
				                }
				            }
				        });
					  
					return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
				});
				
				
				
				
				
				
				
				
				
				 //	轮播图上传   //没有地址，用的时候记得改
		        upload.render({
				    elem: '.car' //绑定元素
				    ,url: 'https://api-develop.zhihuiyouzhan.com.cn/index.php/system/upload/upload?path=merchant.usercard&token=mer_$2y$10$9nhdMGb0TEJEjlDDi8B6l.I1D8nZ37zTWv8LeVZHWkqd2.q8KLQC2' //上传接口
				    ,done: function(res){
				      //上传完毕回调
				      if(res.code==0){
				      	$('.marke-img').eq(num).val(res.data.domain+res.data.list[0])
				      }else{
				      	layer.msg(res.msg,{icon: 2})
				      	
				      }
				      
				    }
				    ,error: function(){
				      //请求异常回调
				       layer.msg('数据请求异常',{icon: 2})
				    }
				 });
        
		        //预览
		        $('.imgview').click(function () {
		        	var img=$(this).parent().find('.marke-img')
			        var imgVal =img.val()
			        if(imgVal == '') {
			        	layer.msg('没有图片可以预览',{icon:2})
			        	return false;
			        }
			        var imgView = "<img style='width:100%;height:100%' src="+imgVal+">";
			        	layer.open({
				            title: '图片预览',
				            area:'750px',
				            content: imgView,
				            shadeClose:true
			       		 });
		   		 })	
		        //删除
		         $('.imgdel').click(function () {
		         	var img=$(this).parent().find('.marke-img')
		       		 if( img.val()==''){
		       		 		layer.msg('没有图片可以删除',{icon:2})
		       		 }else{
		       		 		img.val('')
		       		 }
		    		});
				
			
			
			//全选
			 form.on('checkbox(checked)', function(data){
                checkeds(data)
            });
			checkedAlls($('#checked'))
			
			 //判断是否全选
            function checkeds(data){
                var checkDiv=$(data.elem).parent().children('.layui-form-checkbox')
                var checked=$(data.elem).parent().children(':checkbox')
                if($(data.othis).hasClass('layui-form-checked')){
                    checkDiv.addClass('layui-form-checked')
                    checked.each(function(index,value){
                        value.checked = data.elem.checked;
                    })
                }else{
                    checkDiv.removeClass('layui-form-checked')
                    checked.each(function(index,value){
                        value.checked = data.elem.checked;
                    })
                }
            }
			//全选判断
            function checkedAlls(all){
            	var nums=0
				all.on('click','.layui-form-checkbox',function () {
					var num=0
					all.find('.layui-form-checkbox:gt(0)').each(function(index,value){
						if($(value).hasClass('layui-form-checked')==false){
							num++
						}
					})
					if(num){
						all.find('.layui-form-checkbox').eq(0).removeClass('layui-form-checked')
					}else{
						all.find('.layui-form-checkbox').eq(0).addClass('layui-form-checked')
					}
				})
				
					all.find('.layui-form-checkbox:gt(0)').each(function(index,value){
						if($(value).hasClass('layui-form-checked')==false){
							nums++
						}
					})
					if(nums){
						all.find('.layui-form-checkbox').eq(0).removeClass('layui-form-checked')
					}else{
						all.find('.layui-form-checkbox').eq(0).addClass('layui-form-checked')
					}
				
			}
			
		})
		</script>
	</aside>
	<!--/js-->
	
	
	
	
	
	
	
	
</body>
</html>